#!/usr/bin/env python  
# -*- coding: utf-8 -*-  
from xml.dom import minidom

def doxml(xmlstr):
			 dom = minidom.parseString(xmlstr)		 	
			 print 'Dom:'		 	
			 print dom.toxml() 	
				 	
			 root = dom.firstChild		 	
			 print 'root:'		 	
			 print root.toxml() 	
		 	
			 childs = root.childNodes 	
			 for child in childs:
							 print child.toxml()
							 if child.nodeType == child.TEXT_NODE:
											 pass
							 else:
											 print 'child node attribute name:', child.getAttribute('name')
											 print 'child node name:', child.nodeName
											 print 'child node len:',len(child.childNodes)
											 print 'child data:',child.childNodes[0].data
											 print '======================================='
											 print 'more help info to see:'
											 for med in dir(child):
															 print help(med)

if __name__ == '__main__':
	f=open('/tmp/QihuoHangqing.xml','r')
	xmlstr=f.read()
	f.close()
	
	doxml(xmlstr)
